#ifndef QProdSmetkaKOREKCIJA_H
#define QProdSmetkaKOREKCIJA_H

#include "qmybaseformwidget.h"
#include "ui_qProdSmetkakorekcija.h"
#include <QStandardItemModel>
#include <QHeaderView>
#include "qstablewidgetdelegate.h"


class QProdSmetkaKorekcija : public QMyBaseFormWidget
{
	Q_OBJECT

public:
	QProdSmetkaKorekcija(QWidget *parent = 0);
	~QProdSmetkaKorekcija();
    virtual void pressEscape();
    virtual void pressReturn();
	virtual void pressF9();

    void setFocusLine();
    void setKomintent(QString text, QString textName);
    void setArtikli(QString text, QString textName);
    void setSaldo(QString text);
    void setFocusLine2();
    void init(int id);
	void setProfakturaID(QString text);
	void setIspratnicaID(QString text);

private:
	Ui::QProdSmetkaKorekcijaClass ui;
    bool eventFilter(QObject *object, QEvent *event);
    bool existDok(int idDok);
    QStandardItemModel *model;
    QHeaderView *header; 
    int selRow;
    QString textId;
    int m_id;
    int komintent_id;
    QString artikal_sifra;
    QString komintentID;
	QString prodavnicaID;
	int requestfromKomintent;
    QString dokumentID;
    QSTableWidgetDelegate *pItemDelegate;
    QModelIndex indexPrev;
    bool editorOpen;
    void currentChanged ( const QModelIndex & current, const QModelIndex & previous );
	bool validateKomintent();
	void calculate();
	QString prodavnicaNaziv ;
	QString prodavnicaAdresa;
	QString prodavnicaGrad;
	QString prodavnicaEdb;
	QString prodavnicaZiro;

signals:
    void closeW();
    void scallKomintenti(QWidget*, QString);
    void scallArtikli(QWidget*, QString);
	void scallIspratnici(QWidget*, QString);
	void scallProfakturi(QWidget*, QString);
    void editCell();
    void closeCell();
private slots:
    void on_pushButton_4_clicked();
    void on_pushButton_5_clicked();
    void on_pushButton_6_clicked();
    void on_pushButton_3_clicked();
    void on_pushButton2AAA_2_clicked();
    void on_pushButton1AA_clicked();
	void callImportIspratnici();
	void callImportProfaktura();

    void selectionChanged(QModelIndex,QModelIndex);
    void on_plineEdit3_Pressed();
    void on_plineEdit4_Pressed();
	void on_plineEdit7_Pressed();
	void on_plineEdit12_Pressed();
    void openEditor();
    void closeEditor();
	void updateModelData();
	void on_pushButton1AA8_clicked();
};

#endif // QProdSmetkaKOREKCIJA_H
